home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / asmutil / 68kdis.zip / DOC.NR < prev    next >
Text File  |  1988-12-03  |  7KB  |  195 lines

  1. .\"/*%    nroff -cm -rL72 %|epson|spr -f plain.a -h uncdoc -w
  2. .nr Hb 7
  3. .nr Hs 3
  4. .ds HF 3 3 3 3 3 3 3
  5. .nr Hu 5
  6. .nr Hc 1
  7. .SA 1
  8. .PH "''A Disassembler''"
  9. .PF "'Issue %I%'- Page \\\\nP -'%G%'"
  10. .H 1 "Introduction"
  11. This document describes the first release of a disassembler for UNIX
  12. executable files.
  13. The key features are:
  14. .AL
  15. .LI
  16. For object files the output can be assembled to generate the same
  17. object module, (apart from minor variations in symbol table ordering) as the
  18. input.
  19. .LI
  20. For stripped executable files object modules and libraries may be scanned,
  21. modules in the main input identified and the appropriate names automatically
  22. inserted into the output.
  23. .LI
  24. An option is available to convert most non-global names into local symbols,
  25. which cuts down the symbols in the generated assembler file.
  26. .LI
  27. The disassembler copes reasonably with modules merged with the
  28. .B "-r"
  29. option to
  30. .B "ld" ,
  31. generating a warning message as to the number of modules involved.
  32. .LE
  33. .P
  34. At present this is available for certain Motorola 68000 ports of UNIX
  35. System III and System V. Dependencies on
  36. .AL a
  37. .LI
  38. Instruction set.
  39. .LI
  40. Object module format.
  41. .LI
  42. Library module format.
  43. .LI
  44. Assembler output format.
  45. .LE
  46. .P
  47. are hopefully sufficiently localised to make the product useful as a
  48. basis for other disassemblers for other versions of UNIX.
  49. .P
  50. The product is thus distributed in source form at present.
  51. .H 1 "Use"
  52. The disassembler is run by entering:
  53. .DS I
  54. unc mainfile lib1 lib2 ...
  55. .DE
  56. .P
  57. The first named file is the file to be disassembled, which should be
  58. a single file, either an object module, a (possibly stripped) executable
  59. file, or a library member. Library members are designated using a
  60. parenthesis notation, thus:
  61. .DS I
  62. unc '/lib/libc.a(printf.o)'
  63. .DE
  64. .P
  65. It is usually necessary to escape the arguments in this case to prevent
  66. misinterpretation by the shell. Libraries in standard places such as
  67. .I "/lib"
  68. and
  69. .I "/usr/lib"
  70. may be specified in the same way as to
  71. .B "ld" ,
  72. thus
  73. .DS I
  74. unc '-lc(printf.o)'
  75. unc '-lcurses(wmove.o)'
  76. .DE
  77. .P
  78. As an additional facility, the list of directories searched for
  79. libraries may be varied by setting the environment variable
  80. .B "LDPATH" ,
  81. which is interpreted similarly to the shell
  82. .B "PATH"
  83. variable, and of course defaults to
  84. .DS I
  85. LDPATH=/lib:/usr/lib
  86. .DE
  87. .P
  88. As a further facility, the insertion of
  89. .B "lib"
  90. before and
  91. .B ".a"
  92. after the argument may be suppressed by using a capital
  93. .B "-L"
  94. argument, thus to print out the assembler for
  95. .I "/lib/crt0.o" ,
  96. then the command
  97. .DS I
  98. unc -Lcrt0.o
  99. .DE
  100. .P
  101. should have the desired effect.
  102. .P
  103. Second and subsequent file arguments are only referenced for stripped
  104. executable files, and may consist of single object files and library
  105. members, using the same syntax as before, or whole libraries of object
  106. files, thus:
  107. .DS I
  108. unc strippedfile -Lcrt0.o -lcurses -ltermcap '-lm(sqrt.o)' -lc
  109. .DE
  110. .P
  111. It is advisable to make some effort to put the libraries to be searched
  112. in the order in which they were originally loaded. This is because the
  113. search for each module starts where the previously matched module ended.
  114. However, no harm is done if this rule is not adhered to apart from
  115. increased execution time except in the rare cases where the disassembler
  116. is confused by object modules which are very nearly similar.
  117. .H 1 "Additional options"
  118. The following options are available to modify the behaviour of the
  119. disassembler.
  120. .VL 15 2
  121. .LI "-o file"
  122. Causes output to be sent to the specified file instead of the standard
  123. output.
  124. .LI "-t prefix"
  125. Causes temporary files to be created with the given prefix. The default
  126. prefix is
  127. .B "split" ,
  128. thus causing two temporary files to be created with this prefix in the
  129. current directory. If it is desired, for example, to create the files as
  130. .B "/tmp/xx*" ,
  131. then the argument
  132. .B "-t /tmp/xx"
  133. should be given. Note that the temporary files may be very large as a
  134. complete map of the text and data segments is generated.
  135. .LI "-a"
  136. Suppresses the generation of non-global absolute symbols from the
  137. output. This saves output from C compilations without any obvious
  138. problems, but the symbols are by default included in the name of
  139. producing as nearly identical output as possible to the original source.
  140. .LI "-s"
  141. Causes an additional scan to take place where all possible labels are
  142. replaced by local symbols. The local symbols are inserted in strictly
  143. ascending order, starting at 1.
  144. .LI "-v"
  145. Causes a blow-by-blow account of activities to be output on the standard
  146. error.
  147. .LI "-V"
  148. Causes shlib symbol values to be printed at the top of the output, if they
  149. exist in the symbol table. normally these are ommited because they are constant
  150. values derived form the file /lib/shlib.ifile
  151. .LE
  152. .H 1 "Diagnostics etc"
  153. Truncated or garbled object and library files usually cause processing
  154. to stop with an explanatory message.
  155. .P
  156. The only other kinds of message are some passing warnings concerning
  157. obscure constructs not handled, such as the relocation of byte fields,
  158. or the relocation of overlapping fields. Occasionally a message
  159. .DS I
  160. Library clash: message
  161. .DE
  162. .P
  163. may appear and processing cease. This message is found where at a late
  164. stage in processing libraries, the program discovers that due to the
  165. extreme similarity of two or more library members, it has come to the
  166. wrong conclusion about which one to use. The remedy here is to spell out
  167. to the program which members to take in which order.
  168. .H 1 "Future development"
  169. In the future it is hoped to devise ways of making the disassembler
  170. independent of all the above-mentioned version dependencies, by first
  171. reading a files defining these things. This will probably be applied
  172. after the Common Object Format becomes more standard.
  173. .P
  174. In the long term it would be desirable and useful to enhance the product
  175. to produce compilable C in addition to assemblable assembler. Stages in
  176. the process are seen as follows:
  177. .AL
  178. .LI
  179. Better identification of basic blocks in the code. Switch statements are
  180. a major problem here, as are constant data held in the text segment.
  181. .LI
  182. Marrying of data to the corresponding text. It is in various places hard
  183. to divorce static references "on the fly" (e.g. strings, and switch
  184. lists in some implementations) from static at the head of a module. This
  185. is part of the problem of identifying basic blocks.
  186. .LI
  187. Compilation of header files to work out structure references within the
  188. text. At this stage some interaction may be needed.
  189. .LE
  190. .P
  191. Meanwhile the product is one which is a useful tool to the author in its
  192. present form. Comments and suggestions as to the most practical method
  193. of improving the product in the ways suggested or in other ways would be
  194. gratefully considered.
  195.